package com.roc.steelend.service.Impl;

import com.roc.steelend.controller.vo.returnformat.ReturnMsgForTable;
import com.roc.steelend.mapper.EmployeeMapper;
import com.roc.steelend.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class EmployeeServiceImpl  implements EmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public ReturnMsgForTable findEmployeeByShow(Integer now, Integer size, Integer departmentId) {
        ReturnMsgForTable returnMsgForTable = new ReturnMsgForTable();
        returnMsgForTable.setCurrenPage(now);
        now=(now-1)*size;
        returnMsgForTable.setObjectList(employeeMapper.findEmployeeByShow(now,size,departmentId));
        returnMsgForTable.setTotal(employeeMapper.findEmployeeByShowCount(departmentId));
        return returnMsgForTable;
    }

    @Override
    public List<HashMap<String, Object>> findEmployeeData(Integer employeeId) {


        return employeeMapper.findEmployeeData(employeeId);
    }

    @Override
    public List<HashMap<String, Object>> findEmployeeMsg(Integer employeeId) {
        return employeeMapper.findEmployeeMsg(employeeId);
    }
}
